<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>cute-transfer: E:/CODE/CPPpro/cute-transfer/Msg&amp;FileTransfer/md5.h源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">cute-transfer</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">E:/CODE/CPPpro/cute-transfer/Msg&amp;FileTransfer/md5.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef MD5_H_INCLUDED</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define MD5_H_INCLUDED</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">using namespace </span>std;
<a name="l00024"></a>00024 <span class="preprocessor">#define X86</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#ifdef X86</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> UINT_64;
<a name="l00027"></a>00027 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> UINT_32;
<a name="l00028"></a>00028 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> UINT_16;
<a name="l00029"></a>00029 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> UINT_8;
<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00032"></a><a class="code" href="classmd5.html">00032</a> <span class="keyword">class </span><a class="code" href="classmd5.html">md5</a>
<a name="l00033"></a>00033 {
<a name="l00034"></a>00034 <span class="keyword">public</span>:
<a name="l00035"></a>00035     <a class="code" href="classmd5.html">md5</a>(<span class="keywordtype">string</span>&amp; str);
<a name="l00036"></a>00036     <a class="code" href="classmd5.html">md5</a>(ifstream&amp; fin);
<a name="l00037"></a>00037     <span class="keywordtype">void</span> md5_init();
<a name="l00038"></a>00038     <span class="keywordtype">void</span> md5_calc();
<a name="l00039"></a>00039     <span class="keywordtype">string</span> md5_get_hash();
<a name="l00040"></a>00040 <span class="keyword">private</span>:
<a name="l00041"></a>00041     <span class="comment">//four chaining varibles</span>
<a name="l00042"></a>00042     <span class="keyword">const</span> <span class="keyword">static</span> UINT_32 A=0x67452301;
<a name="l00043"></a>00043     <span class="keyword">const</span> <span class="keyword">static</span> UINT_32 B=0xefcdab89;
<a name="l00044"></a>00044     <span class="keyword">const</span> <span class="keyword">static</span> UINT_32 C=0x98badcfe;
<a name="l00045"></a>00045     <span class="keyword">const</span> <span class="keyword">static</span> UINT_32 D=0x10325476;
<a name="l00046"></a>00046 
<a name="l00047"></a>00047     UINT_32 a, b, c, d;
<a name="l00048"></a>00048 
<a name="l00049"></a>00049     <span class="keyword">union </span>md5_dig_t
<a name="l00050"></a>00050     {
<a name="l00051"></a>00051         UINT_8  dig8[64];
<a name="l00052"></a>00052         UINT_16 dig16[32];
<a name="l00053"></a>00053         UINT_32 dig32[16];
<a name="l00054"></a>00054         UINT_64 dig64[8];
<a name="l00055"></a>00055     } digest;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057     <span class="keyword">union </span>md5_res_t
<a name="l00058"></a>00058     {
<a name="l00059"></a>00059         UINT_8 res8[16];
<a name="l00060"></a>00060         UINT_32 res32[4];
<a name="l00061"></a>00061     } result;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063     <span class="keyword">inline</span> UINT_32 F(UINT_32 X,UINT_32 Y,UINT_32 Z);
<a name="l00064"></a>00064     <span class="keyword">inline</span> UINT_32 G(UINT_32 X,UINT_32 Y,UINT_32 Z);
<a name="l00065"></a>00065     <span class="keyword">inline</span> UINT_32 H(UINT_32 X,UINT_32 Y,UINT_32 Z);
<a name="l00066"></a>00066     <span class="keyword">inline</span> UINT_32 I(UINT_32 X,UINT_32 Y,UINT_32 Z);
<a name="l00067"></a>00067 
<a name="l00068"></a>00068     <span class="keyword">inline</span> <span class="keywordtype">void</span> FF(UINT_32&amp; a, UINT_32 b, UINT_32 c, UINT_32 d,
<a name="l00069"></a>00069                    UINT_32 Mj, UINT_32 s, UINT_32 ti);
<a name="l00070"></a>00070     <span class="keyword">inline</span> <span class="keywordtype">void</span> GG(UINT_32&amp; a, UINT_32 b, UINT_32 c, UINT_32 d,
<a name="l00071"></a>00071                    UINT_32 Mj, UINT_32 s, UINT_32 ti);
<a name="l00072"></a>00072     <span class="keyword">inline</span> <span class="keywordtype">void</span> HH(UINT_32&amp; a, UINT_32 b, UINT_32 c, UINT_32 d,
<a name="l00073"></a>00073                    UINT_32 Mj, UINT_32 s, UINT_32 ti);
<a name="l00074"></a>00074     <span class="keyword">inline</span> <span class="keywordtype">void</span> II(UINT_32&amp; a, UINT_32 b, UINT_32 c, UINT_32 d,
<a name="l00075"></a>00075                    UINT_32 Mj, UINT_32 s, UINT_32 ti);
<a name="l00076"></a>00076 };
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="preprocessor">#endif // MD5_H_INCLUDED</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>类</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>枚举</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>枚举值</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2011年七月8日 星期五 15:50:01 for cute-transfer by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
